In [ ]:
DATADIR='/home/main/notebooks/data/grass7data/north_carolina/ncrast/'

In [ ]:
!gdalinfo {DATADIR}/basin_50K.tif

Generate a new GRASS LOCATION Specifying the projection parameters using the proj-4 string syntax (information retrieved from the gdalinfo output):


In [ ]:
import grass.script as grass

In [ ]:
proj4 = '+proj=lcc +lat_1=36.1667 +lat_2=34.333 +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137 +rf=298.2572221010042 +to_meter=1'
#this will return an error if the location alreay exist (just ignore it) <-- fix me
try:
    grass.run_command('g.proj', proj4=proj4, location='nc')
except:
    print 'grass location nc already exist'

In [ ]:
!g.mapset location=nc_basic_spm_grass7 mapset=user1

In [ ]:
!g.proj -p

In [ ]:
!r.in.gdal input={DATADIR}/elevation.tif output=elevation -e --o

In [ ]:
%run grassutil.ipy

In [ ]:
makeImage(basemap='elevation', inputlayer='elevation', maptype='raster', 
          vsize=10, maptitle='elevation', region=region2dict(rast='elevation'), legend=False, outputimagename='test.png')

In [ ]:
makeImage(basemap='basins', inputlayer='basins', maptype='raster', 
          vsize=10, maptitle='basind', region=region2dict(rast='basins'), legend=False, outputimagename='test.png')

In [ ]: